﻿namespace HDW_Migrate.Db.Entities;

/// <summary>
/// 检查单
/// </summary>
public class Order: BaseEntity
{
    /// <summary>
    /// HIS 申请单号
    /// </summary>
    public string HisOrderCode { get; set; }
    /// <summary>
    /// HIS 申请单申请日期
    /// </summary>
    public string HisOrderRequestDate { get; set; }
    /// <summary>
    /// HIS检查项目
    /// </summary>
    public string HisExamName { get; set; }
    /// <summary>
    /// 检查号
    /// </summary>
    public string AccessionNumber { get; set; }
    /// <summary>
    /// 预约登记操作时间
    /// </summary>
    public DateTime? RegisterTime { get; set; }
    /// <summary>
    /// 申请单状态
    /// </summary>
    public string Status { get; private set; }
    /// <summary>
    /// 归档错误次数
    /// </summary>
    public int UploadExamErrNum { get; set; }
    /// <summary>
    /// 排队号
    /// </summary>
    public int? QueueNumber { get; set; }
    /// <summary>
    ///  检查室。（暂时没用到）
    /// </summary>
    public string ExamName { get; set; }
    /// <summary>
    /// 备注
    /// </summary>
    public string Note { get; set; }
    /// <summary>
    /// 建议
    /// </summary>
    public string Suggestion { get; set; }
    /// <summary>
    /// 总费用
    /// </summary>
    public double TotalFee { get; set; }
    /// <summary>
    /// 额外值
    /// </summary>
    public string ExtendValue { get; set; }
    /// <summary>
    /// 最后修改时间
    /// </summary>
    public DateTime LastUpdateDateTime { get; set; }
    /// <summary>
    /// 到检时间
    /// </summary>
    public DateTime? ArriveTime { get; set; }
    /// <summary>
    /// 是否来自于HIS
    /// </summary>
    public bool IsFromHIS { get; set; }
    /// <summary>
    /// 是否匹配成功
    /// </summary>
    public bool IsMatch { get; set; }
    /// <summary>
    /// 图像数
    /// </summary>
    public int ImageCount { get; private set; }
    /// <summary>
    /// 胶片是否已打印
    /// </summary>
    public bool IsImagePrinted { get; set; }
    /// <summary>
    /// 是否上锁
    /// </summary>
    public bool IsLock { get; set; }
    /// <summary>
    /// 预约开始时间
    /// </summary>
    public DateTime? ScheduledStartTime { get; set; }
    /// <summary>
    /// 预约结束时间
    /// </summary>
    public DateTime? ScheduledEndTime { get; set; }
    /// <summary>
    /// 拍片时间
    /// </summary>
    public DateTime? StudyDate { get; set; }
    /// <summary>
    /// study id
    /// </summary>
    public string StudyId { get; set; }
    /// <summary>
    /// 临床诊断
    /// </summary>
    public string ClinicalDiagnosis { get; set; }
    /// <summary>
    /// 检查部位名称
    /// </summary>
    public string BodyPartNames { get; set; }//Note:keep all the bodypart in current order.
    /// <summary>
    /// 检查部位Id
    /// </summary>
    public string BodyPartIds { get; set; }//Note:keep all the bodypart ids in current order.
    /// <summary>
    /// 检查项目
    /// </summary>
    public string CheckItems { get; set; }//Note:keep all the bodypart in current order.
    /// <summary>
    /// 患者登记时的年龄单位
    /// </summary>
    public string AgeUnit { get; set; }
    /// <summary>
    /// 患者登记时的年龄单位编码
    /// </summary>
    public string AgeUnitCode { get; set; }
    /// <summary>
    /// 患者登记时的年龄
    /// </summary>
    public int Age { get; set; }
    /// <summary>
    /// 二级年龄单位
    /// </summary>
    public string ExtendAgeUnit { get; set; }
    /// <summary>
    /// 二级年龄单位编码
    /// </summary>
    public string ExtendAgeUnitCode { get; set; }
    /// <summary>
    /// 二级年龄
    /// </summary>
    public int? ExtendAge { get; set; }
    /// <summary>
    /// 就诊信息
    /// </summary>
    public Guid VisitId { get; set; }
    /// <summary>
    /// 申请医师
    /// </summary>
    public Guid? OrderDoctorId { get; set; }
    /// <summary>
    /// 到检医师
    /// </summary>
    public Guid? CheckInDoctorId { get; set; }
    /// <summary>
    /// 报告医师
    /// </summary>
    public Guid? ReportDoctorId { get; set; }
    /// <summary>
    /// 申请医师
    /// </summary>
    public Guid? ApplyDoctorId { get; set; }
    /// <summary>
    /// 申请单对应的特殊专项检查分类Id
    /// </summary>
    public Guid? OrderSpecialClassDicId { get; set; }
    /// <summary>
    /// 诊断组Id
    /// </summary>
    public Guid? DiagnosisGroupId { get; set; }
    /// <summary>
    /// 诊断组名称
    /// </summary>
    public string DiagnosisGroupName { get; set; }
    /// <summary>
    /// 特别指定的申请医师姓名，与Staff表无外键关联
    /// </summary>
    public string SpecifiedApplyDoctorName { get; set; }
    /// <summary>
    /// HardCoded(07837CAC-41EF-4AC7-96F1-315CF64D90D3)(已废弃)
    /// </summary>
    public Guid? OrderMetadataId { get; set; }
    /// <summary>
    /// 最后修改者
    /// </summary>
    public Guid? LastModifierId { get; set; }
    /// <summary>
    /// 申请科室
    /// </summary>
    public Guid? OrderDepartmentId { get; set; }
    /// <summary>
    /// 检查科室
    /// </summary>
    public Guid? ExecDepartmentId { get; set; }
    /// <summary>
    /// 锁定者
    /// </summary>
    public Guid? LockerId { get; set; }
    /// <summary>
    /// 检查医师Id
    /// </summary>
    public Guid? ExecDoctorId { get; set; }
    /// <summary>
    /// 设备类型Id
    /// </summary>
    public Guid? ModalityId { get; set; }
    /// <summary>
    /// 设备Id
    /// </summary>
    public Guid? DeviceId { get; set; }
    /// <summary>
    /// 超声内镜检查类型Id
    /// </summary>
    public Guid? USESExamTypeId { get; set; }
    /// <summary>
    /// 影像存储节点
    /// </summary>
    public string StorageNode { get; set; }
    /// <summary>
    /// 请求区域内协助
    /// </summary>
    public bool RegionAssist { get; set; }
    /// <summary>
    /// 区域协助
    /// </summary>
    public string RegionAssistComments { get; set; }
    /// <summary>
    /// 区域协助节点
    /// </summary>
    public string RegionAssistNode { get; set; }
    /// <summary>
    /// 区域状态
    /// </summary>
    public int? RegionStatus { get; private set; }
    /// <summary>
    /// 区域同步上传错误次数
    /// </summary>
    public int? UploadErrNum { get; set; }
    /// <summary>
    /// 区域同步下载错误次数
    /// </summary>
    public int? DownloadErrNum { get; set; }
    /// <summary>
    /// 区域协助类型
    /// </summary>
    public int? RegionAssistType { get; set; }
    /// <summary>
    /// 区域协助状态
    /// </summary>
    public int? RegionAssistStatus { get; set; }
    /// <summary>
    /// 上传到中心时间
    /// </summary>
    public DateTime? UploadToRegionTime { get; set; }
    /// <summary>
    /// 集成数据源Code
    /// </summary>
    public string IntegrationSourceCode { get; set; }
    /// <summary>
    /// 确费状态
    /// </summary>
    public string ChargeStatus { get; set; }
    /// <summary>
    /// 叫号状态
    /// </summary>
    public string CallerStatus { get; set; }
    /// <summary>
    /// 阅片界面访问路径
    /// </summary>
    public string TXAIStudyViewUrl { get; set; }
    /// <summary>
    /// AI阅片的处理结果（JSON）
    /// </summary>
    public string TXAIResult { get; set; }

}

/// <summary>
/// 申请单元数据(暂未使用)
/// </summary>
public class OrderMetadata : BaseEntity
{
    /// <summary>
    /// 名称
    /// </summary>
    public string Name { get; set; }
    ///
    public string PatientFormStructure { get; set; }
    ///
    public string VisitFormStructure { get; set; }
    ///
    public string ExamFormStructure { get; set; }
    ///
    public string AdditionalFormStructure { get; set; }
    /// <summary>
    /// 设置
    /// </summary>
    public string Settings { get; set; }
}

/// <summary>
/// 诊断组
/// </summary>
public class DiagnosisGroup : BaseEntity
{
    /// <summary>
    /// 名称
    /// </summary>
    public string Name { get; set; }
    /// <summary>
    /// 描述
    /// </summary>
    public string Description { get; set; }
    /// <summary>
    /// 诊断范围：设备, device id 逗号分隔
    /// </summary>
    public string Devices { get; set; }
    /// <summary>
    /// 诊断范围：检查部位 bodypart id 逗号分隔  空值及代表全部部位
    /// </summary>
    public string BodyParts { get; set; }
    /// <summary>
    /// 最后分发报告时间
    /// </summary>
    public DateTime? LastDistributedTime { get; set; }
    /// <summary>
    /// 医院
    /// </summary>
    public Guid HospitalId { get; set; }
    /// <summary>
    /// 状态
    /// </summary>
    public bool Status { get; set; }
}

/// <summary>
/// 申请单变更历史
/// </summary>
public class OrderHistory : BaseEntity
{
    /// <summary>
    /// 申请单Id
    /// </summary>
    public Guid OrderId { get; set; }
    /// <summary>
    /// 变更记录
    /// </summary>
    public string Content { get; set; }
    /// <summary>
    /// 事件(暂未使用)
    /// </summary>
    public string Event { get; set; }
    /// <summary>
    /// 操作类型
    /// </summary>
    public OrderOperate Operate { get; set; }
    /// <summary>
    /// 操作时间
    /// </summary>
    public DateTime Time { get; set; }
}

/// <summary>
/// 订单操作类型
/// </summary>
public enum OrderOperate
{
    ///
    Lock = 10,
    ///
    UnLock = 20,
    ///
    Modify = 30,
}

/// <summary>
/// 申请单专项检查(需优化)
/// </summary>
public class OrderSpecialClassDic : BaseEntity
{
    /// <summary>
    /// 名称
    /// </summary>
    public string Name { get; set; }
    /// <summary>
    /// 编码
    /// </summary>
    public string Code { get; set; }
    /// <summary>
    /// 排序值
    /// </summary>
    public int Sort { get; set; }
}

/// <summary>
/// 超声内镜检查类型
/// </summary>
public class USESExamType : BaseEntity
{
    /// <summary>
    /// 名称
    /// </summary>
    public string Name { get; set; }
    /// <summary>
    /// 编码
    /// </summary>
    public string Code { get; set; }
    /// <summary>
    /// 描述
    /// </summary>
    public string Description { get; set; }
    /// <summary>
    /// 排序值
    /// </summary>
    public int Sort { get; set; }
    /// <summary>
    /// 助记码
    /// </summary>
    public string MnemonicCode { get; set; }
}
/// <summary>
/// 申请单扩展表(暂未使用)
/// </summary>
public class OrderExtend : BaseEntity
{
    /// <summary>
    /// 名称
    /// </summary>
    public string Name { get; set; }
    /// <summary>
    /// 申请单Id
    /// </summary>
    public Guid OrderId { get; set; }
    /// <summary>
    /// 设定值
    /// </summary>
    public string Value { get; set; }
    /// 
    public string Auth { get; set; }
    /// <summary>
    /// 初步状态
    /// </summary>
    public string PrimilimaryState { get; set; }
}
/// <summary>
/// 申请单附件
/// </summary>
public class OrderAttachment : BaseEntity
{
    /// <summary>
    /// 存储路径
    /// </summary>
    public string ContentFullFillPath { get; set; }
    /// <summary>
    /// 文件名
    /// </summary>
    public string FileName { get; set; }
    /// <summary>
    /// 申请单Id
    /// </summary>
    public Guid OrderId { get; set; }
    /// <summary>
    /// 创建时间
    /// </summary>
    public DateTime? CreateTime { get; set; }
}
/// <summary>
/// 申请单留言信息
/// </summary>
public class OrderComment : BaseEntity
{ 
    /// <summary>
    /// 提交日期
    /// </summary>
    public DateTime SubmittedTime { get; set; }
    /// <summary>
    /// 内容
    /// </summary>
    public string Content { get; set; }
    /// <summary>
    /// 提交者Id
    /// </summary>
    public Guid SubmitterId { get; set; }
    /// <summary>
    /// 申请单Id
    /// </summary>
    public Guid OrderId { get; set; }
}

/// <summary>
/// 申请单辅助技师
/// </summary>
public class OrderAssTech : BaseEntity
{
    /// <summary>
    /// 申请单Id
    /// </summary>
    public Guid OrderId { get; set; }
    /// <summary>
    /// 辅助技师Id
    /// </summary>
    public Guid TechStaffId { get; set; }
}
/// <summary>
/// 申请单预约日志
/// </summary>
public class OrderScheduleLog
{
    ///
    public Guid Id { get; set; }
    /// <summary>
    /// 申请单Id
    /// </summary>
    public Guid OrderId { get; set; }
    /// <summary>
    /// 创建者Id
    /// </summary>
    public Guid StaffId { get; set; }
    /// <summary>
    /// 设备类型
    /// </summary>
    public Guid ModalityId { get; set; }
    /// <summary>
    /// 检查室
    /// </summary>
    public Guid DeviceId { get; set; }
    /// <summary>
    /// 重新预约原因代码
    /// </summary>
    public int ReasonCode { get; set; }
    /// <summary>
    /// 上次预约起始时间
    /// </summary>
    public DateTime? PrevScheduledStartTime { get; set; }
    /// <summary>
    /// 上次预约截止时间
    /// </summary>
    public DateTime? PrevScheduledEndTime { get; set; }
    /// <summary>
    /// 创建时间
    /// </summary>
    public DateTime CreateDateTime { get; set; }
}